package com.smh.a04DateUtilDemo4;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

public class ChronoUnitDemo1 {
    public static void main(String[] args) {

        LocalDateTime today = LocalDateTime.now();
        System.out.println(today);

        LocalDateTime bir = LocalDateTime.of(2004,10,26,0,0,0);
        System.out.println(bir);


        System.out.println(ChronoUnit.YEARS.between(bir,today));
        System.out.println(ChronoUnit.MONTHS.between(bir,today));
        System.out.println(ChronoUnit.DAYS.between(bir,today));
        System.out.println(ChronoUnit.HOURS.between(bir,today));
        System.out.println(ChronoUnit.MINUTES.between(bir,today));
        System.out.println(ChronoUnit.SECONDS.between(bir,today));
        System.out.println(ChronoUnit.MILLIS.between(bir,today));
        System.out.println(ChronoUnit.MICROS.between(bir,today));
        System.out.println(ChronoUnit.NANOS.between(bir,today));
        //半天
        System.out.println(ChronoUnit.HALF_DAYS.between(bir,today));
        //十年
        System.out.println(ChronoUnit.DECADES.between(bir,today));
        //百年
        System.out.println(ChronoUnit.CENTURIES.between(bir,today));
        //千年
        System.out.println(ChronoUnit.MILLENNIA.between(bir,today));
        //纪元数
        System.out.println(ChronoUnit.ERAS.between(bir,today));

    }
}
